import { isNil } from 'lodash-es';
import { notFound } from 'next/navigation';
import { PrivacyPolicyDetailPage } from './privacy-policy-detail-page';
import type { Metadata } from 'next';
import { getPrivacyPolicyBySlug } from '@/api/pd-privacy';

export const metadata: Metadata = {
    title: '隐私政策',
    description: '产品隐私政策详情'
};

export const revalidate = 60;

export default async function Page({ params }: { params: Promise<{ slug: string }> }) {
    const { slug } = await params;
    const policy = await getPrivacyPolicyBySlug(slug);

    if (isNil(policy)) {
        return notFound();
    }

    return <PrivacyPolicyDetailPage policy={policy} />;
}
